package com.zmc.order.controller;

import java.util.Arrays;

import com.zmc.order.application.CommentApplicationService;
import com.zmc.order.infrastructure.bean.query.CommentMemberInfoQuery;
import com.zmc.order.infrastructure.bean.vo.CommentInfoVo;
import com.zmc.order.infrastructure.bean.vo.CommentMemberInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.zmc.order.infrastructure.service.CommentMemberInfoService;
import com.zmc.common.utils.R;



/**
 * 用户评论表
 *
 * @author zmc
 * @email 
 * @date 2025-05-26 10:30:34
 */
@RestController
@RequestMapping("comment/member")
public class CommentMemberInfoController {

    @Autowired
    private CommentMemberInfoService commentMemberInfoService;

    @Autowired
    private CommentApplicationService commentApplicationService;

    /**
     * 列表
     */
    @PostMapping("/list")
    public R list(@RequestBody CommentMemberInfoQuery query){
        return R.ok(commentApplicationService.queryPage(query));
    }


    /**
     * 信息
     */
    @PostMapping("/info")
    public R info(@RequestBody CommentMemberInfoVo vo){
        return R.ok(commentApplicationService.getCommentMemberInfo(vo));
    }

    /**
     * 用户添加/追加评价
     * */
    @RequestMapping("/edit")
    public R userComment(@RequestBody CommentInfoVo vo) {
        commentApplicationService.userComment(vo);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		commentMemberInfoService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
